package study.source.sunghun.service.email;

import java.util.Map;

import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;

public class MailService {
	
	private MailSender mailSender;	
	
	public void setMailSender(MailSender mailSender) {
		this.mailSender = mailSender;
	}


	public void sendMail(String from, String to, String subject, String msg) {
		 
		SimpleMailMessage message = new SimpleMailMessage();
 
		message.setFrom(from);
		message.setTo(to);
		message.setSubject(subject);
		message.setText(msg);
		mailSender.send(message);	
	}
	
	public boolean sendMail(Map param){
		
		SimpleMailMessage message = new SimpleMailMessage();
		
		message.setFrom("les7414@naver.com");
		message.setTo("les7414@naver.com");
		message.setSubject(param.get("subject").toString());
		message.setText(param.get("content").toString());
		mailSender.send(message);
		
		return true;
	}
	
	
}
